home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / WIN_PRO / WNDLIB10.ZIP;1 / WNDDB.H < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-25  |  5.4 KB  |  166 lines

  1. /* WNDDB.H v1.0 Copyright (c) 1993, 1994 Burnham Park Software, Inc. */
  2. #ifndef __WNDDB_H
  3. #define __WNDDB_H
  4.  
  5. #ifndef __WNDCLASS_H
  6. #include <wndclass.h>
  7. #endif
  8.  
  9. #ifndef __COMMDLG_H
  10. #include <commdlg.h>
  11. #endif
  12.  
  13. #ifndef __PRINT_H
  14. #include <print.h>
  15. #endif
  16.  
  17. #define IDD_Filename 50
  18. #define IDD_Directory 51
  19. #define IDD_Files 52
  20. #define IDD_Directories 53
  21. #define IDD_Description 54
  22. #define IDD_Text 55
  23.  
  24. #define DBF_NONE 0
  25. #define DBF_CENTER 1
  26.  
  27. #define MF_MEMERROR 0
  28. #define MF_READERROR 1
  29. #define MF_TYPEERROR 2
  30. #define MF_WRITEERROR 3
  31. #define MF_REPLACE 4
  32. #define MF_VERSIONERROR 5
  33.  
  34. #define PF_NONE 0
  35. #define PF_CENTER 1
  36. #define PF_SETUP 2
  37. #define PF_BANDING 4
  38. #define PF_LANDSCAPE 8
  39. #define PF_NEWPAGE 16
  40. #define PF_SECOND 32
  41.  
  42. DBFUNC FileOpenProc(HWND hwnd, WORD message, WORD wparam, LONG lparam);
  43. DBFUNC FileSaveasProc(HWND hwnd, WORD message, WORD wparam, LONG lparam);
  44.  
  45. class FILEDB_CLASS : public FILE_CLASS{
  46.   char filename[96], filespec[16], defaultspec[6], caption[41], description[41];
  47.   char* applicationname;
  48.   unsigned int status, head;
  49.   unsigned char flag;
  50.   HANDLE hinstance;
  51.   public:
  52.     FILEDB_CLASS(char* input) : FILE_CLASS(){
  53.       lstrcpy(defaultspec, input);
  54.       caption[0] = 0;
  55.     }
  56.     FILEDB_CLASS() : FILE_CLASS(){
  57.       lstrcpy(defaultspec, "*.*");
  58.       caption[0] = 0;
  59.     }
  60.     char *Getfilespec() { return filespec; }
  61.     char *Getfilename() { return filename; }
  62.     char *Getdefaultspec() { return defaultspec; }
  63.     char *Getcaption() { return caption; }
  64.     char *Getdescription() { return description; }
  65.     char *Getapplicationname() { return applicationname; }
  66.     int Gethead() { return head; }
  67.     int Getflag() { return flag; }
  68.     HANDLE Gethinstance() { return hinstance; }
  69.     void Setdefaultspec(char* input) { lstrcpy(defaultspec, input); }
  70.     void Setcaption(char* input) { lstrcpy(caption, input); }
  71.     void Setdescription(char* input) { lstrcpy(description, input); }
  72.     void Setapplicationname(char* input) { applicationname = input; }
  73.     void Sethinstance(HANDLE input) { hinstance = input; }
  74.     void parsefilename(LPSTR string1, LPSTR string2);
  75.     void DescriptionList(HWND hwnd);
  76.     int FileOpen(HWND hwnd, int f);
  77.     int FileOpen(HWND hwnd) { return FileOpen(hwnd, DBF_CENTER); }
  78.     int FileSaveas(HWND hwnd, int f);
  79.     int FileSaveas(HWND hwnd) { return FileSaveas(hwnd, DBF_CENTER); }
  80.     int DescriptionOpen(HWND hwnd, int input, int f);
  81.     int DescriptionOpen(HWND hwnd, int input)
  82.      { return DescriptionOpen(hwnd, input, DBF_CENTER); }
  83.     int DescriptionSaveas(HWND hwnd, int f);
  84.     int DescriptionSaveas(HWND hwnd) { return DescriptionSaveas(hwnd, DBF_CENTER); }
  85.     int FileMessage(HWND hwnd, int flag);
  86.     int FileRead(HWND hwnd);
  87.     int FileWrite(HWND hwnd);
  88. };
  89.  
  90. extern FILEDB_CLASS fc;
  91.  
  92. BOOL FAR PASCAL AbortProc(HDC hdc, short ncode);
  93. DBFUNC PrintProc(HWND hwnd, WORD message, WORD wparam, LONG lparam);
  94.  
  95. class PRINTDB_CLASS : public PRINT_CLASS{
  96.   unsigned char abort, flag, page, printpage;
  97.   unsigned int vertical, horizontal, height, width, line;
  98.   char printname[40];
  99.   FARPROC abortproc, printproc;
  100.   HWND hprint;
  101.   HANDLE hinstance;
  102.   PRINTDLG pd;
  103.   DEVMODE dm;
  104.   DEVNAMES dn;
  105.   public:
  106.     PRINTDB_CLASS(){
  107.       abort = flag = page = FALSE;
  108.       abortproc = printproc = NULL;
  109.       hprint = NULL;
  110.       printname[0] = 0;
  111.     }
  112.     ~PRINTDB_CLASS() { Freeproc(); }
  113.     int Getabort() { return abort; }
  114.     int Getflag() { return flag; }
  115.     int Getpage() { return page; }
  116.     int Getprintpage() { return printpage; }
  117.     int Getline() { return line; }
  118.     int Getbanding() { return (flag & PF_BANDING) > 0; }
  119.     int Getvertical() { return vertical; }
  120.     int Gethorizontal() { return horizontal; }
  121.     int Getheight() { return height; }
  122.     int Getwidth() { return width; }
  123.     char *Getprintname() { return printname; }
  124.     HWND Gethprint() { return hprint; }
  125.     HANDLE Gethinstance() { return hinstance; }
  126.     void Setabort(int input) { abort = input; }
  127.     void Setabort() { Setabort(TRUE); }
  128.     void Setflag(int input) { flag = input; }
  129.     void Setpage(int input) { page = input; }
  130.     void Setprintpage(int input) { printpage = input; }
  131.     void Setvertical(int input) { vertical = input; }
  132.     void Sethorizontal(int input) { horizontal = input; }
  133.     void Setheight(int input) { height = input; }
  134.     void Setwidth(int input) { width = input; }
  135.     void Setline(int input) { line = input; }
  136.     void Sethprint(HWND input) { hprint = input; }
  137.     void Sethinstance(HANDLE input) { hinstance = input; }
  138.     void Setabortproc();
  139.     void Resetabort() { Setabort(FALSE); }
  140.     void Freeproc(){
  141.       if(abortproc){
  142.         FreeProcInstance(abortproc);
  143.         abortproc = NULL;
  144.       }
  145.       if(printproc){
  146.         FreeProcInstance(printproc);
  147.         printproc = NULL;
  148.       }
  149.     }
  150.     int Testprint() { return error == FALSE && abort == FALSE; }
  151.     int Testpage(int page);
  152.     int PrintMessage(HWND hwnd, int flag);
  153.     int PrintMessage(HWND hwnd) { return PrintMessage(hwnd, error); }
  154.     int Printsetup(HWND hwnd, char *text, int f);
  155.     int Printsetup(HWND hwnd, char *text) { return Printsetup(hwnd, text, PF_CENTER); }
  156.     void Printersetup(HWND hwnd) { Printsetup(hwnd, NULL, PF_SETUP); }
  157.     void Printwindup(HWND hwnd);
  158.     void Startpage();
  159.     int Endpage();
  160.     void PrintText(int dx, int dy, LPSTR text);
  161. };
  162.  
  163. extern PRINTDB_CLASS pc;
  164.  
  165. #endif
  166.